<template>
	<div class="drug-category">
		<fs-page>
			<fs-crud ref="crudRef" v-bind="crudBinding">
				<template #form_quantity="scope">
					{{ scope }}
					<el-form-item
          v-for="(item, index) in selectedIds"
          :key="item.id"
          style="margin-bottom: 20px"
          :prop="item.code"
          :rules="{ required: true, message: '请输入数量', trigger: 'blur' }"
        >
          <el-input v-model="scope.form.quantity[index]" :disabled="scope.mode === 'view'" placeholder="请输入" />
        </el-form-item>
				</template>
			</fs-crud>
		</fs-page>
	</div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { createCrudOptions } from './crud';

import { useFs } from '@fast-crud/fast-crud';

defineOptions({
	name: 'DrugInfo',
});

const { crudBinding, crudRef, crudExpose, selectedIds } = useFs({ createCrudOptions });


onMounted(() => {
	crudExpose.doRefresh();
});
</script>

<style lang="scss" scoped></style>
